/**
 * @Author: 九璃怀特 1599130621@qq.com
 * @Date: 2023-12-22 14:58:02
 * @LastEditors: 九璃怀特 1599130621@qq.com
 * @LastEditTime: 2023-12-22 15:23:38
 * @FilePath: \zxi-surface-guide\src\components\BaseUI\index.ts
 * @Description:
 */
import { App, Plugin } from "vue";
import PmButton from "./button";
import PmText from "./text";
import PmDrawer from "./drawer";
import PmScroll from "./scroll";

const BaseUI = [PmButton, PmText, PmDrawer, PmScroll];

export function PmInstall<T extends { name: string }>(c: T) {
  (c as T & Plugin).install = (app: App): void => {
    app.component(c.name, c);
  };
  return c as T & Plugin;
}

export default {
  install: (app: App) => {
    BaseUI.forEach((c) => {
      if (app.component(c.name) === undefined) {
        app.component(c.name, c);
      }
    });
  },
};
